#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << (a) << " ";
#define debugl(a) cerr << #a << " = " << (a) << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;


int n, k;

void load()
{
	cin >> n >> k;
}

int f[123];
int a[123];

void solve()
{
	int k = ::k;
	for (int i = 0; i <= 30; i++)
	{
		f[i]  = 1 << i;
		a[i] = 0;
	}
	int sz = 0;
	int m = n;
   	for (;k > 1;)
   	{
   		k--;
   		for (int j = 1; ; j++)
   		{
   			if (f[m - 1] >= k)
   			{
   				a[sz++] = j;
   				m--;
   				break;
   			}
   			else
   			{
   				k -= f[m - 1];
   				m--;
   			}
   		}
   	}
   	for (int i = sz - 1; i >= 0; i--)
   	{
   		for (int j = 0; j < i; j++)
   			a[i] += a[j];
   	}
   	for (int i = 0; i < sz; i++)
   	{
   		cout << a[i] << " ";
   	}
}

#define file "bag"
int main()
{
	freopen(file".in", "rt", stdin);
	freopen(file".out", "wt", stdout);
	load();
//	for (k = 1; k <= (1 << n); k++)
//	{	
		solve();
//		cout <<"\n";
//	}
	return 0;
}
